CREATE FUNCTION PersonaPorPag
(
@Pag INT,
@Num INT

)
RETURNS TABLE
AS
RETURN (
		SELECT ROW_NUMBER () OVER (ORDER by  P.Paterno) as Nro, P.Paterno, P.Materno, P.Nombre, P.SegundoNombre 
			FROM Persona P
			ORDER BY P.Paterno
			OFFSET (@Pag-1) * @Num ROWS FETCH NEXT @Num ROWS ONLY
	   )
GO

